package com.tyfspring.beans.support;

import com.tyfspring.beans.factory.BeanDefinitionRegistry;
import com.tyfspring.core.io.DefaultResourceLoader;
import com.tyfspring.core.io.ResourceLoader;

/**
 * @Description BeanDefinitionReader的抽象实现类，实现getRegistry 和 getResourceLoader
 * @Author shallow
 * @Date 2023/4/5 3:20
 */

public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader{

    private final BeanDefinitionRegistry registry;

    private ResourceLoader resourceLoader;

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this.registry = registry;
        this.resourceLoader = new DefaultResourceLoader();
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return this.registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return this.resourceLoader;
    }


}
